<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:winter="http://www.winter.org">
<body>
	<div th:fragment="vehiculo">
		<winter:output id="DialogOutput">
			
		</winter:output>
		<winter:output id="CrearEditarVehiculoOutput">
			<!-- 			<div id="NuevoVehiculoContainer" class="form-container" th:if="${vehiculos.context.vehiculo}"> -->
			<div id="BarraNuevoVehiculo" class="headerbar"
				th:if="${vehiculos.context.vehiculo}">
				<div class="form-title" th:text="@{'Vehiculo'}">Vehiculo</div>
		    	<winter:row>
		    		<winter:column type="col-md-4">
		    	   		<winter:inputtext
							id="VehiculoNuevoChasis" 
							field="*{vehiculo.nrochasis}"
							label="#{label.vehiculo.nrochasis}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize"
							maxlength="200">
						</winter:inputtext>
						<winter:inputtext
							id="VehiculoNuevoValor" 
							field="*{vehiculo.valor}" 
							label="#{label.vehiculo.valor}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text"
							required="true"
							requiredmessage="#{label.vehiculo.valor.requerido}"
							type="float">
						</winter:inputtext>
						<winter:select id="selectPaisVehiculo" field="*{vehiculo.pais}"
							collection="pais, rowPais : ${vehiculos.paises}"
							value="@{${pais.id}+'|'+${pais.descripcion}}"
							text="@{${pais.descripcion}}"
							label="#{label.persona.pais}" required="true"
							requiredmessage="#{label.persona.pais.requerido}" modern="true"
							showglobalmessage="true"
							addemptyvalue="true">
						</winter:select>
		    	   		<!-- <winter:inputtext
							id="VehiculoNuevoCertificadoSerie" 
							field="*{vehiculo.certificadoserie}"
							label="#{label.vehiculo.certificado.serie.nro}"
							maxlength="2"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize input-serie">
						</winter:inputtext> -->
		    	   		<winter:inputtext
							id="VehiculoNuevoCertificadonro" 
							field="*{vehiculo.certificadonro}"
							type="alphanum"
							label="#{label.vehiculo.certificadonro}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize"
							maxlength="10"
							maxlengthmessage="Favor ingrese hasta 10 caracteres">
						</winter:inputtext>
		    	   </winter:column>
		    	   <winter:column type="col-md-4">
		    	   		<winter:inputtext
							id="VehiculoNuevoSerie" 
							field="*{vehiculo.nroserie}" 
							label="#{label.vehiculo.nroserie}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize"
							maxlength="200"
							maxlengthmessage="Favor ingrese hasta 200 digitos">
						</winter:inputtext>
						<winter:select id="selectMonedaVehiculo" field="*{vehiculo.moneda}"
							collection="mon, rowmon : ${vehiculos.monedas}"
							value="@{${mon.id}+'|'+${mon.descripcion}}"
							text="@{${mon.descripcion}}"
							label="#{label.vehiculo.moneda}" 
							required="true"
							requiredmessage="#{label.vehiculo.moneda.requerido}" 
							modern="true"
							showglobalmessage="true">
						</winter:select>
						<winter:select id="selectEstadoVehiculo"
							field="*{vehiculo.estado}"
							collection="estado, rowestado : ${vehiculos.estados}"
							value="@{${estado.id}+'|'+${estado.descripcion}}"
							text="@{${estado.descripcion}}"
							label="#{label.vehiculo.estado}"
							required="false"
							requiredmessage="#{label.vehiculo.estado.requerido}"
							modern="true">
						</winter:select>
						<winter:check id="nuevoVehiculoActivo" field="*{vehiculo.activo}"
							label="#{label.common.activo}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8">
						</winter:check>
		    	   </winter:column>
		    	   <winter:column type="col-md-4">
		    	   		<winter:inputtext
							id="VehiculoNuevoChapa" 
							field="*{vehiculo.Chapa}"
							label="#{label.vehiculo.chapa}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text capitalize"
							maxlength="10">
						</winter:inputtext>
						<winter:select id="selectUsoVehiculo"
							field="*{vehiculo.uso}"
							collection="uso, rowuso : ${vehiculos.usos}"
							value="@{${uso.id}+'|'+${uso.descripcion}}"
							text="@{${uso.descripcion}}"
							label="#{label.vehiculo.uso}"
							required="true"
							requiredmessage="#{label.vehiculo.uso.requerido}"
							modern="true" showglobalmessage="true">
						</winter:select>
						<winter:textarea
							id="VehiculoNuevoAnexo" 
							field="*{vehiculo.anexo}"
							label="#{label.vehiculo.anexo}"
							labeldisplay="col-xs-4"
							inputdisplay="col-xs-8"
							containerdisplay="row padded"
							class="winter-input-text">
						</winter:textarea>
		    	   </winter:column>
		    	 </winter:row>
			</div>
			<div id="NuevoVehiculoInfoContainer" class="form-container"
				th:if="${vehiculos.context.vehiculo}">
				<winter:grid>
					<winter:row columns="1">
			    	 	<winter:select id="selectTemplate" field="*{vehiculo.template}"
							collection="tmp, rowtmp : ${vehiculos.templates}"
							value="@{${tmp.id}+'|'+${tmp.nombre}}" 
							text="${tmp.nombre}"
							label="@{'Tipo: '}"
							required="false"
							requiredmessage="#{label.vehiculo.template.requerido}"
							modern="true" 
							addemptyvalue="true" 
							showglobalmessage="true">
						</winter:select>
						<!-- <winter:select id="selectDato" field="*{vehiculoInfo.datoComplementario}"
							collection="dato, rowdato : ${vehiculos.datosComplementarios}" 
							value="@{${dato.id}+'|'+${dato.descripcion}}"
							text="${dato.descripcion}" 
							label="#{label.vehiculo.dato}" 
							modern="true"
							showglobalmessage="true">
						</winter:select>
						<winter:event id="EventSelectDato" event="change"
							target="selectDato"
							url="@{'/vehiculos/selectDatoEvent'}" form="VehiculosForm"
							update="CrearEditarVehiculoOutput, VehiculoInfoOutput" object="vehiculos" immediate="true"
							showstatus="true" showstatuselement="true">
						</winter:event> -->
			    	 </winter:row>
	    	 	</winter:grid>
				<winter:output id="VehiculoInfoOutput">
					<winter:datatable 
						id="ListaVehiculosInfo"
						customLanguage="true"
						paginate="true"
						jQuery="true"
						retrieve="true"
						emptyTableText="No se encontraron Datos!"
						infoText="Mostrando _START_ al _END_ de _TOTAL_ registros"
						emptyTableInfoText="Mostrando 0 al 0 de 0 registros"
						searchText="Buscar"
						lengthMenu="Mostrar _MENU_ registros"
						if="${vehiculos.context.vehiculo}">
						<thead>
							<tr>
							    <th th:text="@{'Dato'}"></th>
							    <th th:text="@{'Valor'}"></th>
							</tr>
						</thead>
						<tbody>
							<tr th:each="vehiculoInfo, rowStat : ${vehiculos.vehiculo.vehiculosInfo}" style="line-height: 2em;">
								<td th:text="${vehiculoInfo.datoComplementario.descripcion}" class="align-center"></td>
								<td>
									<winter:inputtext
										id="@{'NuevoVehiculoDatoTexto'+${rowStat.index}}" 
										field="*{vehiculo.vehiculosInfo[__${rowStat.index}__].valor}"
										inputdisplay="col-xs-8"
										containerdisplay="row padded"
										class="winter-input-text"
										placeholder="#{label.vehiculo.valor}"
										maxlength="${vehiculoInfo.datoComplementario.longitud}"
										type="${beans.convert.tipoDato(vehiculoInfo.datoComplementario.tipoDato.codigo)}"
										if="${#strings.contains(vehiculoInfo.datoComplementario.tipoDato.codigo,'STRING') and !vehiculoInfo.datoComplementario.usaListaDeValores}">
									</winter:inputtext>
									<winter:inputtext
										id="@{'NuevoVehiculoDatoInteger'+${rowStat.index}}"
										field="*{vehiculo.vehiculosInfo[__${rowStat.index}__].valorInteger}"
										inputdisplay="col-xs-8"
										containerdisplay="row padded"
										class="winter-input-text"
										placeholder="#{label.vehiculo.valor}"
										maxlength="${vehiculoInfo.datoComplementario.longitud}"
										type="${beans.convert.tipoDato(vehiculoInfo.datoComplementario.tipoDato.codigo)}"
										format="${#strings.contains(vehiculoInfo.datoComplementario.tipoDato.codigo,'INTEGER')}"
										thousandsSeparator="."
										decimalSeparator=","
										decimalLimit="${vehiculoInfo.datoComplementario.precisiondato}"
										if="${#strings.contains(vehiculoInfo.datoComplementario.tipoDato.codigo,'INTEGER') and !vehiculoInfo.datoComplementario.usaListaDeValores}">
									</winter:inputtext>
									<winter:datetimepicker
										id="@{'NuevoVehiculoDatoFecha'+${rowStat.index}}"
										field="*{vehiculo.vehiculosInfo[__${rowStat.index}__].valor}"
										format="DD/MM/YYYY"
										if="${#strings.contains(vehiculoInfo.datoComplementario.tipoDato.codigo,'DATE') and !vehiculoInfo.datoComplementario.usaListaDeValores}">
									</winter:datetimepicker>
									<winter:inputtext
										id="@{'autocompleteListaValorDato'+${rowStat.index}}" 
										field="*{vehiculo.vehiculosInfo[__${rowStat.index}__].valor}"
										inputdisplay="col-xs-8"
										containerdisplay="row padded"
										class="winter-input-text"
										placeholder="#{label.vehiculo.valor}"
										maxlength="${vehiculoInfo.datoComplementario.longitud}"
										type="${beans.convert.tipoDato(vehiculoInfo.datoComplementario.tipoDato.codigo)}"
										if="${vehiculoInfo.datoComplementario.usaListaDeValores}">
									</winter:inputtext>
									<!-- <winter:select
										id="@{'selectListaValorDato'+${rowStat.index}}"
										field="*{vehiculo.vehiculosInfo[__${rowStat.index}__].valorRef}"
										collection="val, rowval : ${vehiculoInfo.datoComplementario.listaDeValores}"
										value="@{${val.id}+'|'+${val.descripcion}}"
										text="@{${val.descripcion}}"
										required="false"
										modern="true"
										if="${vehiculoInfo.datoComplementario.usaListaDeValores}">
									</winter:select> -->
								</td>
							</tr>
						</tbody>
					</winter:datatable>
				</winter:output>
				<div class="table-row"></div>
				<winter:row class="button-panel-right" padded="true">
					<winter:ajaxSubmit id="CrearVehiculo" 
						form="VehiculosForm"
						url="@{'/vehiculos/guardarVehiculo'}"
						update="VehiculosOutput, CrearEditarVehiculoOutput"
						object="vehiculos" 
						value="#{label.operaciones.guardar}" 
						showstatus="true"
						class="btn btn-cyan" 
						process="CrearEditarVehiculoOutput"
						if="${vehiculos.context.vehiculo and !#lists.isEmpty(vehiculos.vehiculo.vehiculosInfo)}">
					</winter:ajaxSubmit>
					<winter:ajaxSubmit id="CrearVehiculoCancelar" 
						form="VehiculosForm"
						url="@{'/vehiculos/cancelar/VEHICULO'}" 
						update="VehiculosOutput"
						value="#{label.operaciones.cancelar}" 
						showstatus="true"
						class="btn btn-danger"
						immediate="true">
					</winter:ajaxSubmit>
				</winter:row>
			</div>
		</winter:output>
	</div>

</body>
</html>